﻿using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Sgr.DataCategories.Services
{
    /// <summary>
    /// 数据字典提供者接口
    /// </summary>
    public interface IDataDictionaryProvider
    {
        /// <summary>
        /// 判断是否支持指定类别的数据字典
        /// </summary>
        /// <param name="category">数据字典类别</param>
        /// <returns>如果支持返回 true，否则返回 false</returns>
        bool IsCategorySupported(string category);

        /// <summary>
        /// 异步获取指定类别的数据字典项
        /// </summary>
        /// <param name="category">数据字典类别</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>数据字典项的列表</returns>
        Task<IList<NameValue>> GetItemsAsync(string category,
            CancellationToken cancellationToken = default);
    }
}